/* This stylesheet does not contain any @font-face handling. 
   Instead, it relies on the system serif and sans-serif fonts installed 
   on the device used to read the file. 
*/

/* general blocks */

p, dd { /* general text styles */
  font-family: serif;
  text-indent: 20px;
  font-size: 1em;
  line-height: 125%;
}

section[data-type="preface"] > h1 + p, 
div[data-type="part"] > h1 + p, 
section[data-type="chapter"] > h1 + p, 
section[data-type="chapter"] > h1 + div.author p, 
section[data-type="sect1"] > h1 + p, 
section[data-type="sect2"] > h2 + p,
section[data-type="sect3"] > h3 + p { 
  text-indent: 0px; /* first paragraph following a heading has no indent */
}

/* general inlines */

p a {
  display: inline;
}

/* frontmatter */

section[data-type="titlepage"] h1, 
section[data-type="titlepage"] h2, 
section[data-type="copyright-page"] h1 {
  font-family: sans-serif;
}

section[data-type="halftitlepage"] {
  display: none;
}

section[data-type="titlepage"] {
  text-align: center;
  page-break-after: always;
}

section[data-type="titlepage"] h1 {
  border-bottom: 1px solid #d8d8d8;
  margin-top: 100px;
  padding-bottom: 10px;
}

section[data-type="titlepage"] h1 {
  font-size: 2em;
  line-height: 120%;
}

section[data-type="titlepage"] h2 {
  font-size: 1.2em;
  line-height: 120%;
  margin-top: 20px;
}

/* styling and positioning for author names and other text */

section[data-type="titlepage"] p:first-of-type {
  margin-top: 82pt;
}

section[data-type="titlepage"] p {
  font-family: 'Crimson-Roman', serif;
  font-size: 13pt;
  line-height: 16pt;
  margin-top: 0pt;
  margin-bottom: 0pt;
  float: none;
}

/* copyright page */

section[data-type="copyright-page"] {
  margin-top: 100px;
  page-break-after: always;
}

section[data-type="copyright-page"] h1 {
  font-size: 0.8em;
}

section[data-type="copyright-page"] p {
  font-family: serif;
  font-size: 0.8em;
  margin: 0;
  text-indent: 0;
}

/* dedication */

section[data-type="dedication"] {
  font-family: serif;
  font-style: italic;
  page-break-after: always;
  text-align: center;
  padding-top: 100px;
}

/* table of contents */

/* global styles for the table of contents */
/* table of contents is a series of nested lists in a nav element */

nav[data-type="toc"] a { /* all table of contents entries are also links */
  font-style: normal;
}

nav[data-type="toc"] li { /* no list marker on table of contents entries */
  list-style-type: none;
}

nav[data-type="toc"] > h1 { /* table of contents heading */
  font-size: 1.5em;
  line-height: 120%;
  margin-top: 80px;
  margin-bottom: 50px;
  text-align: center;
}

/* defining fonts for the table of contents */

nav[data-type="toc"] a { 
  text-decoration: none;
}

nav[data-type="toc"] > h1, 
nav[data-type="toc"] li[data-type="chapter"], 
nav[data-type="toc"] li[data-type="part"], 
nav[data-type="toc"] li[data-type="appendix"] {
  font-family: sans-serif;
}

nav[data-type="toc"] li[data-type="preface"] a, 
nav[data-type="toc"] li[data-type="foreword"] a, 
nav[data-type="toc"] li[data-type="glossary"] a, 
nav[data-type="toc"] li[data-type="index"] a {
  font-family: serif;
  font-style: italic;
}

nav[data-type="toc"] li[data-type="chapter"] ol {
  font-family: serif;
}

nav[data-type="toc"] li[data-type="chapter"], 
nav[data-type="toc"] li[data-type="part"], 
nav[data-type="toc"] li[data-type="appendix"] { 
  font-size: 1em;
  line-height: 120%;
  text-transform: uppercase;
  margin-left: 0;
  text-indent: 0;
}

/* entries for parts in the table of contents */

nav[data-type="toc"] li[data-type="part"] { 
  margin-top: 25px;
}

nav[data-type="toc"] li[data-type="part"] > a { 
  border-bottom: 1px solid #d8d8d8;
  width: 100%;
  display: inline-block;
}

nav[data-type="toc"] li[data-type="part"] ol {
  margin-left: 0;
  text-indent: 0;
}

/* entries for chapters and appendixes in the table of contents */

nav[data-type="toc"] li[data-type="chapter"] { 
  margin-top: 20px;
}

nav[data-type="toc"] li[data-type="chapter"]:last-of-type, 
nav[data-type="toc"] li[data-type="appendix"] { 
  margin-bottom: 20px;
}

/* entries for sub-sections */

nav[data-type="toc"] li[data-type="chapter"] ol { 
  font-size: 1em;
  line-height: 120%;
  margin-left: 20px;
  text-indent: -10px;
  text-transform: none;
}

nav[data-type="toc"] li[data-type="chapter"] ol ol { 
  margin-left: 10px;
  text-indent: -10px;
  text-transform: none;
}

/* front and backmatter in the table of contents */

nav[data-type="toc"] li[data-type="preface"], 
nav[data-type="toc"] li[data-type="foreword"], 
nav[data-type="toc"] li[data-type="glossary"], 
nav[data-type="toc"] li[data-type="index"] {
  font-size: 1em;
  line-height: 120%;
}

nav[data-type="toc"] li[data-type="preface"] ol, 
nav[data-type="toc"] li[data-type="foreword"] ol {
  display: none;
}

/* page breaks after all chapter-level sections */

section[data-type="preface"], 
div[data-type="part"], 
section[data-type="chapter"], 
section[data-type="appendix"] {
  page-break-after: always; 
}

/* preface, chapter, and appendix headings */

/* heading font is sans serif */

div[data-type="part"] > h1, 
section[data-type="preface"] > h1, 
section[data-type="chapter"] > h1, 
section[data-type="appendix"] > h1, 
section[data-type="sect1"] h1, 
section[data-type="sect2"] h2, 
section[data-type="sect3"] h3 {
  font-family: sans-serif;
  line-height: 120%;
}

/* shared styles for all chapter-level headings */
section[data-type="preface"] > h1, 
section[data-type="chapter"] > h1, 
section[data-type="appendix"] > h1 {
  font-size: 1.8em;
  margin-top: 70px;
  margin-bottom: 40px;
  text-align: center;
}

/* section headings */

section[data-type="sect1"] h1 { /* A-level headings */
  font-size: 1.5em;
  margin-top: 40px;
  margin-bottom: 20px;
}

section[data-type="sect2"] h2 { /* B-level headings */
  font-size: 1.1em;
  margin-top: 30px;
  margin-bottom: 10px;
  text-transform: uppercase;
}

section[data-type="sect3"] h3 { /* C-level headings */
  font-size: 1.1em;
  margin-top: 20px;
  margin-bottom: 10px;
}

/* parts */

div[data-type="part"] > h1 {
  font-size: 1.8em;
  text-align: center;
  margin-top: 100px;
  margin-bottom: 70px;
}

/* lists */

ul, ol { /* bulleted and numbered lists */
  margin: 10px 0 10px 0;
}

ul li, ol li, 
ul li p, ol li p {
  font-family: serif;
  font-size: 1em;
  line-height: 120%;
  margin-top: 5px;
  text-indent: 0;
}

dl { /* definition lists */
  margin-bottom: 15px;
}

dt { /* definition list terms */
  font-family: sans-serif;
  font-size: 0.9em;
  line-height: 120%;
  margin-top: 15px;
  margin-bottom: 4px;
}

dd { /* definition list descriptions */
  text-indent: 0;
  margin-left: 20px;
}

dd p {
  text-indent: 0;
}

/* tables */

table {
  margin-top: 30px;
  margin-bottom: 30px;
  border-bottom: 1px solid #d8d8d8;
  border-collapse: collapse;
}

table caption {
  font-family: sans-serif;
  font-size: 0.8em;
  line-height: 120%;
  text-align: left;
  margin: 0 0 20px 0;
  padding: 0;
}

tr {
  border-width: 0px;
}

th { /* table heading rows */
  font-family: sans-serif;
  font-size: 0.8em;
  line-height: 120%;
  text-align: left;
  margin-top: 0;
  border-top: 1px solid #d8d8d8;
  border-bottom: 1px solid #d8d8d8;
}

th, td {
  padding: 6px;
}

td, table p { /* table body text */
  font-family: sans-serif;
  font-size: 12px;
  line-height: 120%;
}

table p { /* table body text */
  text-indent: 0;
  margin-top: 6px;
}

td pre.programlisting, td pre.screen, td pre.literallayout, td code { /* allow code in tables to wrap */
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* figures */

figure { /* figure containers */
  margin-top: 30px;
  margin-bottom: 30px;
  padding: 0;
  display: block;
  page-break-inside: avoid;
}

figure img { /* figure images */
  max-width: 100%;
  margin: 0;
}

figcaption {
  font-family: sans-serif;
  font-size: 0.8em;
  line-height: 120%;
  display: block;
}

figure figcaption:first-child { /* figure caption above image */
  border-bottom: 1px solid #d8d8d8;
  padding-bottom: 6px;
  margin-bottom: 6px;
}

figure img + figcaption { /* figure caption below image */
  border-top: 1px solid #d8d8d8;
  padding-top: 6px;
  margin-top: 6px;
}

/* sidebars */

aside { /* sidebar containers */
  border: 1px solid #d8d8d8;
  padding: 20px 20px 10px 20px;
  margin: 30px 0 30px 0;
}

aside h5 { /* sidebar titles */
  font-family: sans-serif;
  font-size: 1em;
  line-height: 120%;
  text-align: center;
  margin: 0;
  padding: 0;
}

aside h6 { /* sidebar subtitles */
  font-family: serif;
  font-weight: bold;
  font-size: 0.9em;
  line-height: 120%;
}

aside p { /* sidebar text */
  font-size: 0.9em;
  line-height: 130%;
  text-indent: 0;
  margin-top: 6px;
}

/* admonitions */

div[data-type="note"], 
div[data-type="warning"] { /* admonition containers */
  border-top: 1px solid #d8d8d8;
  border-bottom: 1px solid #d8d8d8;
  padding: 10px 0;
  margin: 30px 30px 30px 30px;
  page-break-inside: avoid; /* avoid breaking admonitions across pages */
}

div[data-type="note"] h1, 
div[data-type="warning"] h1 { /* admonition titles */
  font-family: sans-serif;
  font-weight: bold;
  font-size: 0.8em;
  text-transform: uppercase;
  text-align: center;
  margin: 4px 0;
  padding: 0;
}

div[data-type="note"] p, 
div[data-type="warning"] p { /* admonition text */
  font-family: sans-serif;
  font-size: 0.8em;
  line-height: 120%;
  text-indent: 0in;
}

/* code */

pre, code { /* monospace font for both code blocks and inline code */
  font-family: monospace;
}

pre { /* code blocks */
  font-size: 0.9em;
  line-height: 120%;
  margin: 10px;
}

code { /* inline code */
  font-size: 0.9em;
  line-height: 120%;
}

table pre { /* code blocks within tables */
  text-indent: 0;
}

div[data-type="note"] code, 
div[data-type="warning"] code, 
aside code, 
table code { /* inline code within notes, sidebars and tables */
  font-size: inherit;
  line-height: inherit;
}

div[data-type="example"] h5 { /* titles for formal code examples */
  font-family: sans-serif;
  font-size: 0.8em;
  line-height: 120%;
  border-bottom: 1px solid #d8d8d8;
  padding-bottom: 6px;
  margin-top: 30px;
}

/* blockquote */

blockquote {
  font-family: sans-serif;
  font-size: 0.8em;
  line-height: 130%;
  margin-left: 30px;
  margin-right: 30px;
}

blockquote p {
  text-indent: 0;
}

/*Kindle Legacy Specific Styles*/
@media amzn-mobi {
  figure caption {
    text-align: center;
    font-size: 75%;
    font-style: italic;
    margin-top: 1em;
    margin-bottom: 1em;
}

h1, h2, h3, h4 {
  margin-top: 1em;
  margin-bottom: 1em;
}

dl {
  margin-top: 0.5em;
}

dl dt {
  display: block;
  margin-top: 0.5em;
}

aside {
  margin-top: 1em;
  margin-bottom: 1em;
}

div[data-type="note"], 
div[data-type="warning"] {
  margin-top: 1em;
  margin-bottom: 1em;
}

div[data-type="note"] h1, 
div[data-type="warning"] h1 {
  font-style: italic;
  text-align: center;
}

div[data-type="example"] h5 {
  margin-top: 1em;
}
}